import Vue from 'vue'
import Router from 'vue-router'
// import Recommend from 'components/recommend/recommend'
// import Singer from 'components/singer/singer'
// import Rank from 'components/rank/rank'
// import Search from 'components/search/search'
//  懒加载写法  需要添加 syntax-dynamic-import 插件
const Recommend = () => import('components/recommend/recommend')  // 返回 Promise
const Singer = () =>import('components/singer/singer')
const Rank = () => import('components/rank/rank')
const Search = () => import('components/search/search')
const SingerDetail = () => import('components/singer-detail/singer-detail')





Vue.use(Router)
//  这些页面由  tab组件进行导航
export default new Router({
  routes: [
    // {
    //   path: '/',
    //   name: 'HelloWorld',
    //   component: HelloWorld
    // }
    {
      path: '/',
      redirect: '/recommend'
    },
    // 推荐
    {
      path: '/recommend',
      component: Recommend,
    },
    //  歌手
    {
      path: '/singer',
      component: Singer,
      children: [
        {
          path: ':id',
          component: SingerDetail
        }
      ]
    },
    // 排行
    {
      path: '/rank',
      component: Rank,
    },
    // 搜索
    {
      path: '/search',
      component: Search,
    },
  ]
})
